from time import sleep

from appium.webdriver.common.appiumby import AppiumBy

from basic.basedriver import DRIVER
from basic.basepage import BasePage
from page.page_navigate_main import PageMain
from page.page_features_shopping_cart import PageShoppingCart


class PageGoodsDetails(BasePage):
    def add_to_cart(self):
        """
        加入购物车
        :return:
        """
        locator = (AppiumBy.XPATH, "//*[@text='加入购物车']")
        self.click(locator)
        locator = (AppiumBy.XPATH, "//*[@text='确定']")
        self.click(locator,2)
        locator = (AppiumBy.XPATH,"//*[@text='购物车']")
        self.click(locator)
        return PageShoppingCart()

if __name__ == '__main__':
    page = PageMain().goto_goods_category().goto_goods_details().add_to_cart()